<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>被关注回复设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
	.face-layer{position: absolute; top:100px; left:40px;width:430px;background:#fff;border: 2px solid #eee;z-index:666666;display:none}
	.face-layer-face{position:relative;overflow: auto;font-size: 0;padding:5px;margin:0}
	.face-layer-face li{cursor: pointer; display: inline-block; vertical-align: bottom; padding:2px 2px; text-align: center;-webkit-box-sizing: border-box !important; -moz-box-sizing: border-box !important; box-sizing: border-box !important;}
	.face-layer-face li img{width: 22px; height: 22px;}
	.hide{display:none}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
			<div class="layui-card-header">被关注回复设置</div>
			<div class="layui-card-body" pad15>
				<div class="layui-form" lay-filter="">
					<div>
						{for start="0" end="3"}
						<div class="layui-colla-item" id="colla-index-{$i}">
							<h2 class="layui-colla-title">第{$i + 1}条回复</h2>
							<div class="layui-colla-content layui-show">
								<input type="hidden" name="info[{$i}][id]" value="{$info[$i]['id']}"/>
								<input type="hidden" name="info[{$i}][ktype]" value="2"/>
								<div class="layui-form-item" style="margin-bottom:10px">
									<label class="layui-form-label">回复类型</label>
									<div class="layui-input-inline" style="width:650px">
										<input type="radio" name="info[{$i}][msgtype]" value="text" title="文本" data-index="{$i}"  {if !$info[$i]['id'] || $info[$i]['msgtype']=='text'}checked{/if} lay-filter="msgtype"/>
										<input type="radio" name="info[{$i}][msgtype]" value="image" title="图片" data-index="{$i}"  {if $info[$i]['msgtype']=='image'}checked{/if} lay-filter="msgtype"/>
										<input type="radio" name="info[{$i}][msgtype]" value="voice" title="语音" data-index="{$i}"  {if $info[$i]['msgtype']=='voice'}checked{/if} lay-filter="msgtype"/>
										<input type="radio" name="info[{$i}][msgtype]" value="video" title="视频" data-index="{$i}"  {if $info[$i]['msgtype']=='video'}checked{/if} lay-filter="msgtype"/>
										<input type="radio" name="info[{$i}][msgtype]" value="music" title="音乐" data-index="{$i}"  {if $info[$i]['msgtype']=='music'}checked{/if} lay-filter="msgtype"/>
										<input type="radio" name="info[{$i}][msgtype]" value="news" title="图文" data-index="{$i}"  {if $info[$i]['msgtype']=='news'}checked{/if} lay-filter="msgtype"/>
										{if in_array('wx',$platform)}
										<input type="radio" name="info[{$i}][msgtype]" value="miniprogrampage" title="小程序卡片" data-index="{$i}"  {if $info[$i]['msgtype']=='miniprogrampage'}checked{/if} lay-filter="msgtype"/>
										{/if}
									</div>
								</div>
								<div style="height:1px;margin-bottom:10px;border-top:1px dotted #e5e5e5"></div>
								<div class="layui-form-item" msgtype="text" {if $info[$i]['id'] && $info[$i]['msgtype']!='text'}style="display:none"{/if}>
									<label class="layui-form-label">回复文字</label>
									<div class="layui-input-block" style="width:480px">
										<textarea type="text" name="text[{$i}]" class="layui-textarea text_content" data-text_content="{$i}"  value="">{$info[$i]['id'] ? $text[$i] : '欢迎您[昵称]，您是第[关注数]位关注者。'}</textarea>
										<div><img src="__STATIC__/admin/img/emojiIcon.png" style="width:40px;height:40px;cursor:pointer" class="get_smile" data-index="{$i}"/></div>
										<div class="face-layer facedialog" data-facedialog="{$i}" style="">
											<ul class="face-layer-face">
												<li title="[微笑]"><img class="face" src="__STATIC__/chat/wxface/0.png"></li><li title="[撇嘴]"><img class="face" src="__STATIC__/chat/wxface/24.png"></li><li title="[色]"><img class="face" src="__STATIC__/chat/wxface/2.png"></li><li title="[发呆]"><img class="face" src="__STATIC__/chat/wxface/3.png"></li><li title="[得意]"><img class="face" src="__STATIC__/chat/wxface/4.png"></li><li title="[流泪]"><img class="face" src="__STATIC__/chat/wxface/5.png"></li><li title="[害羞]"><img class="face" src="__STATIC__/chat/wxface/6.png"></li><li title="[闭嘴]"><img class="face" src="__STATIC__/chat/wxface/7.png"></li><li title="[睡]"><img class="face" src="__STATIC__/chat/wxface/8.png"></li><li title="[大哭]"><img class="face" src="__STATIC__/chat/wxface/9.png"></li><li title="[尴尬]"><img class="face" src="__STATIC__/chat/wxface/10.png"></li><li title="[发怒]"><img class="face" src="__STATIC__/chat/wxface/11.png"></li><li title="[调皮]"><img class="face" src="__STATIC__/chat/wxface/12.png"></li><li title="[呲牙]"><img class="face" src="__STATIC__/chat/wxface/13.png"></li><li title="[惊讶]"><img class="face" src="__STATIC__/chat/wxface/14.png"></li><li title="[难过]"><img class="face" src="__STATIC__/chat/wxface/15.png"></li><li title="[酷]"><img class="face" src="__STATIC__/chat/wxface/16.png"></li><li title="[囧]"><img class="face" src="__STATIC__/chat/wxface/17.png"></li><li title="[抓狂]"><img class="face" src="__STATIC__/chat/wxface/18.png"></li><li title="[吐]"><img class="face" src="__STATIC__/chat/wxface/19.png"></li><li title="[偷笑]"><img class="face" src="__STATIC__/chat/wxface/20.png"></li><li title="[愉快]"><img class="face" src="__STATIC__/chat/wxface/21.png"></li><li title="[白眼]"><img class="face" src="__STATIC__/chat/wxface/22.png"></li><li title="[傲慢]"><img class="face" src="__STATIC__/chat/wxface/23.png"></li><li title="[困]"><img class="face" src="__STATIC__/chat/wxface/25.png"></li><li title="[惊恐]"><img class="face" src="__STATIC__/chat/wxface/26.png"></li><li title="[流汗]"><img class="face" src="__STATIC__/chat/wxface/27.png"></li><li title="[憨笑]"><img class="face" src="__STATIC__/chat/wxface/28.png"></li><li title="[悠闲]"><img class="face" src="__STATIC__/chat/wxface/29.png"></li><li title="[奋斗]"><img class="face" src="__STATIC__/chat/wxface/30.png"></li><li title="[咒骂]"><img class="face" src="__STATIC__/chat/wxface/31.png"></li><li title="[疑问]"><img class="face" src="__STATIC__/chat/wxface/32.png"></li><li title="[嘘]"><img class="face" src="__STATIC__/chat/wxface/33.png"></li><li title="[晕]"><img class="face" src="__STATIC__/chat/wxface/34.png"></li><li title="[衰]"><img class="face" src="__STATIC__/chat/wxface/36.png"></li><li title="[骷髅]"><img class="face" src="__STATIC__/chat/wxface/37.png"></li><li title="[敲打]"><img class="face" src="__STATIC__/chat/wxface/38.png"></li><li title="[再见]"><img class="face" src="__STATIC__/chat/wxface/39.png"></li><li title="[擦汗]"><img class="face" src="__STATIC__/chat/wxface/40.png"></li><li title="[抠鼻]"><img class="face" src="__STATIC__/chat/wxface/41.png"></li><li title="[鼓掌]"><img class="face" src="__STATIC__/chat/wxface/42.png"></li><li title="[糗大了]"><img class="face" src="__STATIC__/chat/wxface/43.png"></li><li title="[坏笑]"><img class="face" src="__STATIC__/chat/wxface/44.png"></li><li title="[左哼哼]"><img class="face" src="__STATIC__/chat/wxface/45.png"></li><li title="[右哼哼]"><img class="face" src="__STATIC__/chat/wxface/46.png"></li><li title="[哈欠]"><img class="face" src="__STATIC__/chat/wxface/47.png"></li><li title="[鄙视]"><img class="face" src="__STATIC__/chat/wxface/48.png"></li><li title="[委屈]"><img class="face" src="__STATIC__/chat/wxface/49.png"></li><li title="[快哭了]"><img class="face" src="__STATIC__/chat/wxface/50.png"></li><li title="[阴险]"><img class="face" src="__STATIC__/chat/wxface/51.png"></li><li title="[亲亲]"><img class="face" src="__STATIC__/chat/wxface/52.png"></li><li title="[吓]"><img class="face" src="__STATIC__/chat/wxface/53.png"></li><li title="[可怜]"><img class="face" src="__STATIC__/chat/wxface/54.png"></li><li title="[菜刀]"><img class="face" src="__STATIC__/chat/wxface/55.png"></li><li title="[西瓜]"><img class="face" src="__STATIC__/chat/wxface/56.png"></li><li title="[啤酒]"><img class="face" src="__STATIC__/chat/wxface/57.png"></li><li title="[篮球]"><img class="face" src="__STATIC__/chat/wxface/58.png"></li><li title="[乒乓]"><img class="face" src="__STATIC__/chat/wxface/59.png"></li><li title="[咖啡]"><img class="face" src="__STATIC__/chat/wxface/60.png"></li><li title="[饭]"><img class="face" src="__STATIC__/chat/wxface/61.png"></li><li title="[猪头]"><img class="face" src="__STATIC__/chat/wxface/62.png"></li><li title="[玫瑰]"><img class="face" src="__STATIC__/chat/wxface/63.png"></li><li title="[凋谢]"><img class="face" src="__STATIC__/chat/wxface/64.png"></li><li title="[嘴唇]"><img class="face" src="__STATIC__/chat/wxface/65.png"></li><li title="[爱心]"><img class="face" src="__STATIC__/chat/wxface/66.png"></li><li title="[心碎]"><img class="face" src="__STATIC__/chat/wxface/67.png"></li><li title="[蛋糕]"><img class="face" src="__STATIC__/chat/wxface/68.png"></li><li title="[闪电]"><img class="face" src="__STATIC__/chat/wxface/69.png"></li><li title="[炸弹]"><img class="face" src="__STATIC__/chat/wxface/70.png"></li><li title="[刀]"><img class="face" src="__STATIC__/chat/wxface/71.png"></li><li title="[足球]"><img class="face" src="__STATIC__/chat/wxface/72.png"></li><li title="[瓢虫]"><img class="face" src="__STATIC__/chat/wxface/73.png"></li><li title="[便便]"><img class="face" src="__STATIC__/chat/wxface/74.png"></li><li title="[月亮]"><img class="face" src="__STATIC__/chat/wxface/75.png"></li><li title="[太阳]"><img class="face" src="__STATIC__/chat/wxface/76.png"></li><li title="[礼物]"><img class="face" src="__STATIC__/chat/wxface/77.png"></li><li title="[拥抱]"><img class="face" src="__STATIC__/chat/wxface/78.png"></li><li title="[强]"><img class="face" src="__STATIC__/chat/wxface/79.png"></li><li title="[弱]"><img class="face" src="__STATIC__/chat/wxface/80.png"></li><li title="[握手]"><img class="face" src="__STATIC__/chat/wxface/81.png"></li><li title="[胜利]"><img class="face" src="__STATIC__/chat/wxface/82.png"></li><li title="[抱拳]"><img class="face" src="__STATIC__/chat/wxface/83.png"></li><li title="[勾引]"><img class="face" src="__STATIC__/chat/wxface/84.png"></li><li title="[拳头]"><img class="face" src="__STATIC__/chat/wxface/85.png"></li><li title="[差劲]"><img class="face" src="__STATIC__/chat/wxface/86.png"></li><li title="[爱你]"><img class="face" src="__STATIC__/chat/wxface/87.png"></li><li title="[NO]"><img class="face" src="__STATIC__/chat/wxface/88.png"></li><li title="[OK]"><img class="face" src="__STATIC__/chat/wxface/89.png"></li><li title="[跳跳]"><img class="face" src="__STATIC__/chat/wxface/90.png"></li><li title="[发抖]"><img class="face" src="__STATIC__/chat/wxface/91.png"></li><li title="[怄火]"><img class="face" src="__STATIC__/chat/wxface/92.png"></li><li title="[转圈]"><img class="face" src="__STATIC__/chat/wxface/93.png"></li>
											</ul>
										</div>
									</div>
									<div class="layui-form-mid layui-word-aux" style="margin-left:110px">"[关注数]"，"[昵称]" 将被替换为当前的关注数、当前关注用户的昵称，例如：欢迎您[昵称]，您是第[关注数]位关注者。</div>
								</div>
								<div class="layui-form-item" msgtype="text" {if $info[$i]['id'] && $info[$i]['msgtype']!='text'}style="display:none"{/if}>
									<label class="layui-form-label">关注基数</label>
									<div class="layui-input-inline">
										<input type="text" name="info[{$i}][sort]" class="layui-input" value="{if $info[$i]['id']}{$info[$i]['sort']}{else}0{/if}">
									</div>
									<div class="layui-form-mid layui-word-aux">从多少开始计算，[关注数] = 关注基数 + 实际关注数</div>
								</div>
								<div class="layui-form-item" msgtype="image" {if $info[$i]['msgtype']!='image'}style="display:none"{/if}>
									<label class="layui-form-label">回复图片</label>
									<input type="hidden" name="image[{$i}][url]" id="imageurl_{$i}" class="layui-input" value="{$image[$i]['url']}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="imageurl_{$i}" upload-preview="imageurlPreview_{$i}" onclick="uploader(this,false,{'browser':'active','wximage':''})">上传图片</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;"></div>
									<div id="imageurlPreview_{$i}" style="float:left;padding-top:10px;margin-left:110px;clear: both;">
										<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$image[$i]['url']}"/></div></div>
									</div>
								</div>
								<div class="layui-form-item" msgtype="voice" {if $info[$i]['msgtype']!='voice'}style="display:none"{/if}>
									<label class="layui-form-label">回复语音</label>
									<input type="hidden" name="voice[{$i}][url]" id="voiceurl_{$i}" class="layui-input" value="{$voice[$i]['url']}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="voiceurl_{$i}" upload-preview="voiceurlPreview_{$i}" onclick="uploader(this,false,{'browser':'active','wxvoice':''})">上传音频</button>
									<div id="voiceurlPreview_{$i}" class="layui-form-mid" style="margin-left:20px;">{if $voice[$i]['url']}已上传{/if}</div>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">请上传mp3格式的音频，不大于2M</div>
								</div>
								<div class="layui-form-item" msgtype="video" {if $info[$i]['msgtype']!='video'}style="display:none"{/if}>
									<label class="layui-form-label">回复视频</label>
									<input type="hidden" name="video[{$i}][url]" id="videourl_{$i}" class="layui-input" value="{$video[$i]['url']}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="videourl_{$i}" upload-preview="videourlPreview_{$i}" onclick="uploader(this,false,{'browser':'active','wxvideo':''})">上传视频</button>
									<div id="videourlPreview_{$i}" class="layui-form-mid" style="margin-left:20px;">{if $video[$i]['url']}已上传{/if}</div>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">请上传mp4格式的视频，不大于10M</div>
								</div>
								<div class="layui-form-item" msgtype="video" {if $info[$i]['msgtype']!='video'}style="display:none"{/if}>
									<label class="layui-form-label">视频标题</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="video[{$i}][title]" class="layui-input" value="{$video[$i]['title']}">
									</div>
								</div>
								<div class="layui-form-item" msgtype="video" {if $info[$i]['msgtype']!='video'}style="display:none"{/if}>
									<label class="layui-form-label">视频描述</label>
									<div class="layui-input-inline" style="width:400px">
										<textarea type="text" name="video[{$i}][description]" class="layui-textarea" value="">{$video[$i]['description']}</textarea>
									</div>
								</div>

								<div class="layui-form-item" msgtype="music" {if $info[$i]['msgtype']!='music'}style="display:none"{/if}>
									<label class="layui-form-label">音乐标题</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="music[{$i}][title]" class="layui-input" value="{$music[$i]['title']}">
									</div>
								</div>
								<div class="layui-form-item" msgtype="music" {if $info[$i]['msgtype']!='music'}style="display:none"{/if}>
									<label class="layui-form-label">音乐描述</label>
									<div class="layui-input-inline" style="width:400px">
										<textarea type="text" name="music[{$i}][description]" class="layui-textarea" value="">{$music[$i]['description']}</textarea>
									</div>
								</div>
								<div class="layui-form-item" msgtype="music" {if $info[$i]['msgtype']!='music'}style="display:none"{/if}>
									<label class="layui-form-label">音乐图片</label>
									<input type="hidden" name="music[{$i}][pic]" id="musicpic_{$i}" class="layui-input" value="{$music[$i]['pic']}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="musicpic_{$i}" upload-preview="musicpicPreview_{$i}" onclick="uploader(this)">上传图片</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;"></div>
									<div id="musicpicPreview_{$i}" style="float:left;padding-top:10px;margin-left:110px;clear: both;">
										<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$music[$i]['pic']}"/></div></div>
									</div>
								</div>
								<div class="layui-form-item" msgtype="music" {if $info[$i]['msgtype']!='music'}style="display:none"{/if}>
									<label class="layui-form-label">音乐链接</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="music[{$i}][url]" lay-verType="tips" id="musicurl_{$i}" class="layui-input" value="{$music[$i]['url']}">
									</div>
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="musicurl_{$i}" onclick="uploader(this)">上传</button>
									<div class="layui-form-mid layui-word-aux" style="float:left;padding-top:10px;margin-left:110px;clear: both;">请填写http://或https://开头的完整链接地址</div>
								</div>

								<div class="layui-form-item" msgtype="news" {if $info[$i]['msgtype']!='news'}style="display:none"{/if}>
									<label class="layui-form-label">图文标题</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="news[{$i}][title]" class="layui-input" value="{$news[$i]['title']}">
									</div>
								</div>
								<div class="layui-form-item" msgtype="news" {if $info[$i]['msgtype']!='news'}style="display:none"{/if}>
									<label class="layui-form-label">图文描述</label>
									<div class="layui-input-inline" style="width:400px">
										<textarea type="text" name="news[{$i}][description]" class="layui-textarea" value="">{$news[$i]['description']}</textarea>
									</div>
								</div>
								<div class="layui-form-item" msgtype="news" {if $info[$i]['msgtype']!='news'}style="display:none"{/if}>
									<label class="layui-form-label">图文图片</label>
									<input type="hidden" name="news[{$i}][pic]" id="linkpic_{$i}" class="layui-input" value="{$news[$i]['pic']}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="linkpic_{$i}" upload-preview="linkpicPreview_{$i}" onclick="uploader(this)">上传图片</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×320像素 或 80×80像素</div>
									<div id="linkpicPreview_{$i}" style="float:left;padding-top:10px;margin-left:110px;clear: both;">
										<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$news[$i]['pic']}"/></div></div>
									</div>
								</div>
								<div class="layui-form-item" msgtype="news" {if $info[$i]['msgtype']!='news'}style="display:none"{/if}>
									<label class="layui-form-label">打开链接</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="news[{$i}][url]" lay-verType="tips" id="newsurl_{$i}" class="layui-input" value="{$news[$i]['url']}">
									</div>
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="newsurl_{$i}" onclick="uploader(this)">上传</button>
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="chooseUrl(0, {$i})">选择链接</button>
									<div class="layui-form-mid layui-word-aux" style="float:left;padding-top:10px;margin-left:110px;clear: both;">请填写http://或https://开头的完整链接地址</div>
								</div>

								<div class="layui-form-item" msgtype="miniprogrampage" {if $info[$i]['msgtype']!='miniprogrampage'}style="display:none"{/if}>
									<label class="layui-form-label">消息标题</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="miniprogrampage[{$i}][title]" class="layui-input" value="{$miniprogrampage[$i]['title']}">
									</div>
								</div>
								<div class="layui-form-item" msgtype="miniprogrampage" {if $info[$i]['msgtype']!='miniprogrampage'}style="display:none"{/if}>
									<label class="layui-form-label">封面图片</label>
									<input type="hidden" name="miniprogrampage[{$i}][pic]" id="miniprogrampagepic_{$i}" class="layui-input" value="{$miniprogrampage[$i]['pic']}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="miniprogrampagepic_{$i}" upload-preview="miniprogrampagepicPreview_{$i}" onclick="uploader(this)">上传图片</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：520*416像素</div>
									<div id="miniprogrampagepicPreview_{$i}" style="float:left;padding-top:10px;margin-left:110px;clear: both;">
										<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$miniprogrampage[$i]['pic']}"/></div></div>
									</div>
								</div>
								<div class="layui-form-item" msgtype="miniprogrampage" {if $info[$i]['msgtype']!='miniprogrampage'}style="display:none"{/if}>
									<label class="layui-form-label">页面路径</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="miniprogrampage[{$i}][pagepath]" id="pagepath_{$i}" class="layui-input" value="{$miniprogrampage[$i]['pagepath']}">
									</div>
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="chooseUrl(1,{$i})">选择链接</button>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">状态</label>
									<div class="layui-input-inline" style="width:500px">
										<input type="radio" name="info[{$i}][status]" value="1" title="开启"  {if $info[$i]['status']==1}checked{/if}/>
										<input type="radio" name="info[{$i}][status]" value="0" title="关闭"  {if $info[$i]['status']==0}checked{/if}/>
									</div>
								</div>
							</div>
						</div>
                        {/for}
					</div>
					<div class="layui-form-item" style="margin-top: 15px;">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="formsubmit">确 定</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	{include file="public/js"/}
	<script>
        $(function () {
            //表情
            $('.get_smile').click(function () {
                var index = $(this).attr('data-index');
                $('[data-facedialog="' + index + '"]').show();
            })
            $(document).click(function (e) {
                var drag = $(".facedialog"),
                    btnel = $(".get_smile"),
                    target = e.target;
                var shouldHide = true;
                drag.each(function () {
                    var dragel = $(this)[0];
                    if (dragel === target || $.contains(dragel, target)) {
                        shouldHide = false;
                    }
                });
                btnel.each(function () {
                    var buttonElement = $(this)[0];
                    if (buttonElement === target || $.contains(buttonElement, target)) {
                        shouldHide = false;
                    }
                });
                if (shouldHide) {
                    drag.hide();
                }
            });

            $('.face-layer-face > li').click(function () {
                $('.facedialog').hide();
                var face = $(this).attr('title');
                var index = $(this).closest('.face-layer').attr('data-facedialog'); // 获取当前表情对话框的索引
                $('[data-text_content="' + index + '"]').val(function (i, val) {
                    return val + face;
                }).keyup();
            });
        })
        layui.form.on('radio(msgtype)', function (data) {
            var index = $(this).attr('data-index');
            var boxId = "colla-index-" + index;
            $('#' + boxId).find('div[msgtype]').hide();
            if (data.value == 'text') {
                $('#' + boxId).find('div[msgtype=text]').show();
            } else if (data.value == 'image') {
                $('#' + boxId).find('div[msgtype=image]').show();
            } else if (data.value == 'voice') {
                $('#' + boxId).find('div[msgtype=voice]').show();
            } else if (data.value == 'video') {
                $('#' + boxId).find('div[msgtype=video]').show();
            } else if (data.value == 'music') {
                $('#' + boxId).find('div[msgtype=music]').show();
            } else if (data.value == 'news') {
                $('#' + boxId).find('div[msgtype=news]').show();
            } else if (data.value == 'miniprogrampage') {
                $('#' + boxId).find('div[msgtype=miniprogrampage]').show();
            }
        });
        layui.form.on('submit(formsubmit)', function(obj) {
            var field = obj.field;
            var isValid = true;
            $('[id^="colla-index-"]').each(function() {
                var index = $(this).attr('id').split('-')[2];
                // var id = field['info[' + index + '][id]'];
                var msgType = field['info[' + index + '][msgtype]'];
                if (msgType === 'text' && field['text[' + index + ']'] === '') {
                    dialog('请输入回复文字', 0);
                    isValid = false;
                    return false;
                } else if (msgType === 'image' && field['image[' + index + '][url]'] === '') {
                    dialog('请上传回复图片', 0);
                    isValid = false;
                    return false;
                } else if (msgType === 'voice' && field['voice[' + index + '][url]'] === '') {
                    dialog('请上传回复语音', 0);
                    isValid = false;
                    return false;
                } else if (msgType === 'video' && field['video[' + index + '][url]'] === '') {
                    dialog('请上传回复视频', 0);
                    isValid = false;
                    return false;
                } else if (msgType === 'music') {
                    if (field['music[' + index + '][title]'] === '') {
                        dialog('请输入音乐标题', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['music[' + index + '][description]'] === '') {
                        dialog('请输入音乐描述', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['music[' + index + '][pic]'] === '') {
                        dialog('请输入音乐图片', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['music[' + index + '][url]'] === '') {
                        dialog('请输入音乐链接', 0);
                        isValid = false;
                        return false;
                    }
                } else if (msgType === 'news') {
                    if (field['news[' + index + '][title]'] === '') {
                        dialog('请输入图文标题', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['news[' + index + '][description]'] === '') {
                        dialog('请输入图文描述', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['news[' + index + '][pic]'] === '') {
                        dialog('请上传图文图片', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['news[' + index + '][url]'] === '') {
                        dialog('请输入打开链接', 0);
                        isValid = false;
                        return false;
                    }
                } else if (msgType === 'miniprogrampage') {
                    if (field['miniprogrampage[' + index + '][title]'] === '') {
                        dialog('请输入消息标题', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['miniprogrampage[' + index + '][pic]'] === '') {
                        dialog('请输入封面图片', 0);
                        isValid = false;
                        return false;
                    }
                    if (field['miniprogrampage[' + index + '][pagepath]'] === '') {
                        dialog('请输入打开链接', 0);
                        isValid = false;
                        return false;
                    }
                }
            });
            if (isValid) {
                var index = layer.load();
                $.post("{:url('subscribeSave')}", obj.field, function(data) {
                    layer.close(index);
                    dialog(data.msg, data.status, true);
                });
            }
            return false;
        });


	//选择链接
	var urltype = 0,currentIndex = 0;
	function chooseUrl(type,index){
		urltype = type;
        currentIndex = index;
		layer.open({type:2,shadeClose:true,area:['1200px', '650px'],'title':'选择链接',content:"{:url('DesignerPage/chooseurl')}"})
	}
	function chooseLink(urlname,url){
		if(urltype==0){
			url = '{$Think.const.PRE_URL2}/h5/{$aid}.html#'+url;
            $("input[id='newsurl_" + currentIndex + "']").val(url);
		}else if(urltype==1){
            $("input[id='pagepath_" + currentIndex + "']").val(url);
		}else{
			//$("input[name='menu_pagepath']").val(url.substr(1));
		}
	}
  </script>
</body>
</html>